package com.hengda.museumonline.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hengda.museumonline.R;
import com.hengda.museumonline.adapter.CommentAdapter;

/**
 * @author：JFWU on 2016/9/23 10:46
 * @E-mail：jeffy12138@126.com
 */
public class CommentActivity extends BaseActivity implements View.OnClickListener {
    private android.widget.TextView tvcommentto;
    private android.widget.TextView tvcommentfrom;
    private android.support.v7.widget.RecyclerView rvcommentto;
    private android.support.v7.widget.RecyclerView rvcommentfrom;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_comment);
        this.tvcommentfrom = (TextView) findViewById(R.id.tv_comment_from);
        tvcommentfrom.setOnClickListener(this);
        this.tvcommentto = (TextView) findViewById(R.id.tv_comment_to);
        tvcommentto.setOnClickListener(this);

        this.rvcommentfrom = (RecyclerView) findViewById(R.id.rv_comment_from);
        this.rvcommentto = (RecyclerView) findViewById(R.id.rv_comment_to);
        rvcommentto.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, true));
        rvcommentto.setAdapter(new CommentAdapter(CommentActivity.this));
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_comment_to:
                rvcommentto.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, true));
                rvcommentto.setAdapter(new CommentAdapter(CommentActivity.this));
                rvcommentto.setVisibility(View.VISIBLE);
                rvcommentfrom.setVisibility(View.GONE);
                tvcommentto.setTextColor(getResources().getColor(R.color.bg));
                tvcommentfrom.setTextColor(getResources().getColor(R.color.comment));
                break;
            case R.id.tv_comment_from:
                rvcommentfrom.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, true));
                rvcommentfrom.setAdapter(new CommentAdapter(CommentActivity.this));
                rvcommentfrom.setVisibility(View.VISIBLE);
                rvcommentto.setVisibility(View.GONE);
                tvcommentfrom.setTextColor(getResources().getColor(R.color.bg));
                tvcommentto.setTextColor(getResources().getColor(R.color.comment));
                break;
        }
    }
}
